<?php

$pid = pcntl_fork();
cli_set_process_title("php-master");
if ($pid){
    echo "this is parent process\n";
    pcntl_wait($status);
    echo "回收子进程\n";
}else if ($pid==0){
    cli_set_process_title("php-worker");
    echo "this is child process\n";
    sleep(10);
}else{
    die('fork failed\n');;
}